Skip to content

Latest commit

 

History

History
25 lines (22 loc) · 785 Bytes

File metadata and controls

25 lines (22 loc) · 785 Bytes

[*] Save & Load Data

  • Numpy provides the functionality for storing and reading numpy array from file, helpful for storing and loading the procesed data.
  • Adds .npy extension to the filename, stores in non-ascii format.
>>> a = np.array([[np.random.randint(-5,5) for i in range (5)] for j in range(5)])
>>> np.save('./test', a)

>>> b = np.load('./test.npy')
>>> b
array([[-2,  3, -3, -1,  1],
       [-4,  0,  2,  0, -2],
       [-3, -1, -2, -5,  2],
       [ 4,  4, -1, -4,  3],
       [-3,  3,  3,  4,  4]])
>>> a == b
array([[ True,  True,  True,  True,  True],
       [ True,  True,  True,  True,  True],
       [ True,  True,  True,  True,  True],
       [ True,  True,  True,  True,  True],
       [ True,  True,  True,  True,  True]])
>>> a is b
False